package com.yiyuplatform.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;

/**
 * @Description
 * @Author dalong
 * @Date 2021-11-08
 */

@Getter
@Setter
@ToString
@NoArgsConstructor
@EqualsAndHashCode
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler", "fieldHandler"}, ignoreUnknown = true)
@Entity
@Table(name = "chat_t_records")
public class ChatTRecords implements Serializable {
    private static final long serialVersionUID = 6700032374067143591L;

    /**
     * 消息uuid,插入时使用uuid()生成Id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "M_ID")
    private String mId;

    /**
     * 消息内容，前端另写代码限制长度。若消息内容为文件，则为内容为文件Url
     */
    @Column(name = "M_TEXT")
    private String mText;

    /**
     * 接受状态，发送失败/发送成功
     */
    @Column(name = "M_STATUS")
    private String mStatus;

    /**
     * 发送时间
     */
    @Column(name = "M_SENDTIME")
    private Timestamp mSendtime;

    /**
     * 外键，消息类型 1.文本 2.图片 3.文件
     */
    @Column(name = "M_TYPE")
    private Long mType;

    /**
     * 发送者ID，外键
     */
    @Column(name = "M_SENDERID")
    private String mSenderid;

    /**
     * 外键，聊天记录所属会话
     */
    @Column(name = "M_SESSIONKEY")
    private String mSessionkey;

}
